package cn.calm.j2se.jpa.entity;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the bundle_info database table.
 * 
 */
@Entity
@Table(name="BUNDLE_INFO")
public class BundleInfo implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private BundleInfoPK id;

	@Column(name="BUNDLE_INFO_VALUE", length=1000)
	private String bundleInfoValue;

	//bi-directional many-to-one association to Bundle
    @ManyToOne
	@JoinColumns({
		@JoinColumn(name="BUNDLE_SYMBOLIC_NAME", referencedColumnName="BUNDLE_SYMBOLIC_NAME", nullable=false, insertable=false, updatable=false),
		@JoinColumn(name="BUNDLE_VERSION", referencedColumnName="BUNDLE_VERSION", nullable=false, insertable=false, updatable=false)
		})
	private Bundle bundle;

    public BundleInfo() {
    }

	public BundleInfoPK getId() {
		return this.id;
	}

	public void setId(BundleInfoPK id) {
		this.id = id;
	}
	
	public String getBundleInfoValue() {
		return this.bundleInfoValue;
	}

	public void setBundleInfoValue(String bundleInfoValue) {
		this.bundleInfoValue = bundleInfoValue;
	}

	public Bundle getBundle() {
		return this.bundle;
	}

	public void setBundle(Bundle bundle) {
		this.bundle = bundle;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BundleInfo other = (BundleInfo) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
}